﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{


   

    public partial class Main : Form
    {

        String textbox1 = " ";
        String textbox2 = " ";
        String textbox3 = " ";
       /// Sugar selectedSugar1;
       // Sugar selectedSugar2;
        //Sugar selectedSugar3;
        //Sugar selectedSugar4;
        String selectedSugar1;
        String selectedSugar2;
        String selectedSugar3;
        String selectedSugar4;


        public Main()
        {
            InitializeComponent();
        }

        /// <summary>
        /// gets the Sugars combo box
        /// </summary>
        /// <returns></returns>
        public ComboBox getComboBox0()
        {
            return Sugars;
        }

        private void Sugars_SelectedIndexChanged(object sender, EventArgs e)
        {
            selectedSugar1 =  (String)Sugars.SelectedItem;

            if (selectedSugar1.Equals("Others"))
            {
                AddForm add = new AddForm(Sugars, sugars2, sugars3, sugars4);
                add.Show();
            }
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            textbox1 = textBox1.SelectedText;
        }

        private void sugars2_SelectedIndexChanged(object sender, EventArgs e)
        {
            selectedSugar2 = (String)sugars2.SelectedItem;

            

            if (selectedSugar2.Equals("Others"))
            {
                AddForm add = new AddForm(Sugars, sugars2, sugars3, sugars4);
                add.Show();
            }
        }

        private void sugars3_SelectedIndexChanged(object sender, EventArgs e)
        {
            selectedSugar3 = (String)sugars3.SelectedItem;

            if (selectedSugar3.Equals("Others"))
            {
                AddForm add = new AddForm(Sugars, sugars2, sugars3, sugars4);
                add.Show();
            };
        }

        private void sugars4_SelectedIndexChanged(object sender, EventArgs e)
        {
            selectedSugar4 =  (String)sugars4.SelectedItem;

            if (selectedSugar4.Equals("Others"))
            {
                AddForm add = new AddForm(Sugars, sugars2, sugars3, sugars4);
                add.Show();
            }
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            textbox2 = textBox2.SelectedText;
        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {
            textbox3 = textBox3.SelectedText;
        }

        private void textBox4_TextChanged(object sender, EventArgs e)
        {
            textbox3 = textBox3.SelectedText;
        }

        private void closeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void textBox5_TextChanged(object sender, EventArgs e)
        {

        }

        private void syncToolStripMenuItem_Click(object sender, EventArgs e) {
            DatabaseSync syncForm = new DatabaseSync();
            syncForm.Show();
        }
    }
}
